package com.sy.simpleegg.ui.banner.videoplayer

import android.content.Context
import android.util.AttributeSet
import android.util.Log
import com.shuyu.gsyvideoplayer.GSYVideoManager
import com.shuyu.gsyvideoplayer.video.base.GSYVideoControlView
import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
import com.sy.simpleegg.R

class BannerVideoPlayer : GSYVideoControlView {
    constructor(context: Context) : super(context) {
        hideAllWidget()
    }

    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
        hideAllWidget()
    }

    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
        context,
        attrs,
        defStyleAttr
    ) {
        hideAllWidget()
    }

    constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)

    override fun showWifiDialog() {}
    override fun showProgressDialog(
        deltaX: Float,
        seekTime: String,
        seekTimePosition: Int,
        totalTime: String,
        totalTimeDuration: Int
    ) {
    }

    override fun dismissProgressDialog() {}
    override fun showVolumeDialog(deltaY: Float, volumePercent: Int) {}
    override fun dismissVolumeDialog() {}
    override fun showBrightnessDialog(percent: Float) {}
    override fun dismissBrightnessDialog() {}
    override fun onClickUiToggle() {}
    override fun hideAllWidget() {
        setViewShowState(mBottomContainer, INVISIBLE)
        setViewShowState(mTopContainer, INVISIBLE)
        setViewShowState(mBottomProgressBar, INVISIBLE)
        setViewShowState(mStartButton, INVISIBLE)
    }

    override fun changeUiToNormal() {}
    override fun changeUiToPreparingShow() {}
    override fun changeUiToPlayingShow() {}
    override fun changeUiToPauseShow() {}
    override fun changeUiToError() {}
    override fun changeUiToCompleteShow() {}
    override fun changeUiToPlayingBufferingShow() {}
    override fun backFromFull(context: Context): Boolean {
        return false
    }

    override fun releaseVideos() {}
    override fun getGSYVideoManager(): GSYVideoViewBridge {
        GSYVideoManager.instance().initContext(context.applicationContext)
        return GSYVideoManager.instance()
    }

    override fun getLayoutId(): Int {
        return R.layout.video_layout_default
    }

    override fun startPlayLogic() {
        Log.d("BannerVideoPlayer", "startPlayLogic")
        prepareVideo()
    }

    override fun onBackFullscreen() {}
    override fun setSmallVideoTextureView() {}
    override fun touchDoubleUp() {
//        super.touchDoubleUp();//双击暂停
    }
}
